package com.enzo.prms.common.action;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.jbpm.api.ProcessEngine;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.opensymphony.xwork2.ActionSupport;

@Component("indexAction")
@Scope("prototype")
public class IndexAction extends ActionSupport implements ServletRequestAware {
	private static final long serialVersionUID = 1L;
	private static final Logger LOGGER=Logger.getLogger(IndexAction.class);
	private HttpServletRequest request;
	private ProcessEngine processEngine;
	

	@Override
	public void setServletRequest(HttpServletRequest request) {
		this.request = request;
	}

	public String index() {
		request.setAttribute("titleKey", "Form Title");
		LOGGER.info("jbpm4.4+ssh2");
		LOGGER.info("processEngine: "+processEngine);
//		System.out.println("processEngine: "+processEngine);
		return "index";
	}
	
	public ProcessEngine getProcessEngine() {
		return processEngine;
	}

	@Resource
	public void setProcessEngine(ProcessEngine processEngine) {
		this.processEngine = processEngine;
	}
	
	

}
